package com.learn.springlearn.config;

import com.learn.springlearn.constant.Reply;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestControllerAdvice
public class ExceptionConfig {


    @ExceptionHandler(value = Exception.class)
    public Reply error(HttpServletRequest request,Exception e){
        log.error(request.getRequestURL().toString(),e);
        return Reply.error("失败");
    }
}
